<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>imagefree</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="imagecreate.html" title="imagecreate" />
    <link rel="next" href="imagegetpixel.html" title="imagegetpixel" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">imagefree</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="imagecreate.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="imagegetpixel.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="imagefree"></a>
      <div class="titlepage"></div>
      <a id="IndexImagefree" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">imagefree</span>
        </h2>
        <p>imagecreate — 
      Frees memory allocated for a previously loaded or created image.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp115485952"></a>
        <h2>Description</h2>
        <p>
      Frees memory allocated for a previously loaded or created image.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp115548272"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>imagefree</strong></span> iimagenum</pre>
      </div>
      <div class="refsect1">
        <a id="idp115550288"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iimagenum</em></span> -- reference of the image to free.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp115552016"></a>
        <h2>Examples</h2>
        <p>
	    Here is an example of the imagefree opcode. It uses the file <a class="ulink" href="examples/imageopcodes.csd" target="_top"><em class="citetitle">imageopcodes.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp115553808"></a>
          <p class="title">
            <strong>Example 386. Example of the imagefree opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-n <span class="comment">;no sound output</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span><span class="op">=</span>48000
<span class="ohdr">ksmps</span><span class="op">=</span>1
<span class="ohdr">nchnls</span><span class="op">=</span>2

<span class="comment">; this test .csd copies image.png into a new file 'imageout.png'</span>

giimage1 <span class="opc">imageload</span> "image.png"
giimagew, giimageh <span class="opc">imagesize</span> giimage1
giimage2 <span class="opc">imagecreate</span> giimagew,giimageh

    <span class="oblock">instr</span> 1

kndx <span class="op">=</span> 0
kx_ <span class="opc">linseg</span> 0, p3, 1
<span class="comment">;print imagewidth and imageheigth of image.png</span>
<span class="opc">prints</span> "imagewidth <span class="op">=</span> <span class="op">%</span>f pixels, imageheigth <span class="op">=</span> <span class="op">%</span>f pixels\\n", giimagew, giimageh

<span class="olabel">myloop</span><span class="op">:</span>
ky_ <span class="op">=</span> kndx<span class="op">/</span>(giimageh)
kr_, kg_, kb_ <span class="opc">imagegetpixel</span> giimage1, kx_, ky_
<span class="opc">imagesetpixel</span> giimage2, kx_, ky_, kr_, kg_, kb_
<span class="octrl">loop_lt</span> kndx, 0.5, giimageh, <span class="olabel">myloop</span>
    <span class="oblock">endin</span>

    <span class="oblock">instr</span> 2

<span class="opc">imagesave</span> giimage2, "imageout.png"
    <span class="oblock">endin</span>

    <span class="oblock">instr</span> 3
<span class="opc">imagefree</span> giimage1
<span class="opc">imagefree</span> giimage2
    <span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span>1 1 1
<span class="stamnt">i</span>2 2 1
<span class="stamnt">i</span>3 3 1
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp115555760"></a>
        <h2>See Also</h2>
        <p>
		  <a class="link" href="imageload.html" title="imageload"><em class="citetitle">imageload</em></a>,
		  <a class="link" href="imagecreate.html" title="imagecreate"><em class="citetitle">imagecreate</em></a>,
		  <a class="link" href="imagesize.html" title="imagesize"><em class="citetitle">imagesize</em></a>,
		  <a class="link" href="imagesave.html" title="imagesave"><em class="citetitle">imagesave</em></a>,
		  <a class="link" href="imagegetpixel.html" title="imagegetpixel"><em class="citetitle">imagegetpixel</em></a>,
		  <a class="link" href="imagesetpixel.html" title="imagesetpixel"><em class="citetitle">imagesetpixel</em></a>
	  </p>
      </div>
      <div class="refsect1">
        <a id="idp115562720"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Cesare Marilungo</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.08</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="imagecreate.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="imagegetpixel.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">imagecreate </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> imagegetpixel</td>
        </tr>
      </table>
    </div>
  </body>
</html>
